package com.ljh.localmusic.ui

import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.flow

class CounterViewModel {

    private var count = 0
    private var isRunning = false

    fun start() = flow<Int> {
        while (isRunning){
            emit(count)
            delay(1000)
            count++
        }
    }


    fun stop(){
        isRunning = false
    }

}